<%@ page language="java" contentType="text/html; charset=utf-8" import="java.util.*"
    pageEncoding="utf-8"%>
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>index页面</title>
</head>
<body>
	<%
		//利用request对象获取URL请求传来的数据
		String username = request.getParameter("username");
		String password = request.getParameter("password");
		
		if("admin".equals(username) && "123".equals(password)){
		    //1、通过转发实现页面的跳转，当前是转发到success.jsp页面
		    //注意：在转发的过程中"/"其实代表的是http://服务器名:8080/工程名/
		    request.getRequestDispatcher("/pages/success.jsp").forward(request,response);
		}else{
		    //2、使用重定向来实现跳转
		    //在重定向中"/"代表的是http://localhost:8080
		    response.sendRedirect("/pages/fail.jsp");
		}
		
	%>
</body>
</html>